package main

import (
	"encoding/json"
	"fmt"
	"net/http"
	"practice/model"
)

func Index(w http.ResponseWriter, r *http.Request) {
	var articles []model.Article
	Db.Find(&articles)
	var result = make(map[string]interface{})
	result["status"] = 1
	result["msg"] = "请求成功"
	result["data"] = articles
	data, _ := json.Marshal(result)
	fmt.Println(string(data))
	w.Write(data)
}
